00001
00012 class circleAimlessly : public osg::NodeCallback
00013 {
00014 public:
00018 circleAimlessly(): angle(0.0) {}
00019 virtual void operator () (osg::Node * node, osg::NodeVisitor* nv);
00020 private:
00021 float angle;
00022 };
00023
00028 struct updateAccumulatedMatrix : public osg::NodeCallback
00029 {
00033 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
00034
00038 osg::Matrix matrix;
00039 };
00040
00041
00042 struct transformAccumulator
00043 {
00044
00048 transformAccumulator();
00049
00054 bool attachToGroup(osg::Group* g);
00055
00060 osg::Matrix getMatrix();
00061 protected:
00062 osg::ref_ptr<osg::Group> parent;
00063 osg::Node* node;
00064 updateAccumulatedMatrix* mpcb;
00065 };
00066
00067
00073 class followNodeMatrixManipulator : public osgGA::MatrixManipulator
00074 {
00075 public:
00076 followNodeMatrixManipulator( transformAccumulator* ta) {worldCoordinatesOfNode = ta; theMatrix = osg::Matrixd::identity();}
00077
00082 bool handle (const osgGA::GUIEventAdapter&ea, osgGA::GUIActionAdapter&aa);
00083
00087 void updateTheMatrix();
00088
00093 virtual void setByMatrix(const osg::Matrixd& mat);
00094
00099 virtual void setByInverseMatrix(const osg::Matrixd&mat);
00100
00105 virtual osg::Matrixd getInverseMatrix() const;
00106
00111 virtual osg::Matrixd getMatrix() const;
00112 protected:
00113
00117 ~followNodeMatrixManipulator() {}
00118
00122 transformAccumulator* worldCoordinatesOfNode;
00126 osg::Matrixd theMatrix;
00127 };
00128
00133 class sabitManipulator : public osgGA::MatrixManipulator
00134 {
00135 public:
00136
00141 sabitManipulator( ) {sabitMatrix = osg::Matrixd::identity()
00142
00143 * osg::Matrixd::rotate(M_PI/2.0, osg::Vec3(0,0,1) )
00144 * osg::Matrixd::translate(osg::Vec3(0,0,-500)) ; }
00149 virtual void setByMatrix(const osg::Matrixd& mat) { sabitMatrix = mat;}
00150
00155 virtual void setByInverseMatrix(const osg::Matrixd&mat) { sabitMatrix = mat.inverse(mat);}
00156
00161 virtual osg::Matrixd getInverseMatrix() const
00162 {
00163 osg::Matrixd m;
00164 m = osg::Matrixd::identity()
00165 * osg::Matrixd::rotate(M_PI/2.0, osg::Vec3(0,0,1) )
00166 * osg::Matrixd::translate(osg::Vec3(0,0,-500)) ;
00167 return m;
00168 }
00169
00174 virtual osg::Matrixd getMatrix() const {return sabitMatrix;}
00175 protected:
00179 ~sabitManipulator() {}
00180
00181
00182
00183
00184 osg::Matrixd sabitMatrix;
00185 };